package com.chainyoung.common.utils;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;

public class UpLoadUtils {
    /**
     * @param path
     * @param type 上传类型：1头像，2收款二维码，3凭证
     * @return
     */
    public static RequestBody getBody(String path, int type) {

        File mFile = new File(path);
        RequestBody requestBody = new MultipartBody.Builder().setType(MultipartBody.FORM)
                .addFormDataPart("file", mFile.getName(), RequestBody.create(MediaType.parse("image/png"), mFile))
                .addFormDataPart("type", String.valueOf(type))
                .build();
        return requestBody;
    }

}
